package com.itWaiLong.Mapper;

import com.itWaiLong.Dao.learning_resource;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LearningMapper {

    /**
     * 编辑学习资料
     * @param learningResource
     * @return
     */
    int update(learning_resource learningResource);

    /**
     * 添加学习资料
     * @param learningResource
     * @return
     */

    int add(learning_resource learningResource);

    /**
     * 通过资料id删除资料
     * @param resourceId
     * @return
     */
    @Delete("delete from campus_programming.learning_resource where resource_id = #{resourceId}")
    int delete(int resourceId);

    /**
     * 通过资料id查询资料
     * @param resourceId
     * @return
     */
    @Select("select * from campus_programming.learning_resource where resource_id = #{resourceId}")
    learning_resource selectById(Integer resourceId);


    /**
     * 查询所有学习资料
     * @return
     */
    @Select("select * from campus_programming.learning_resource")
    List<learning_resource> selectAll();
}
